import req from './base';

function getUser(params, headers){
  let opt = {
    method: 'GET',
    url: `/api/v2/member/memberinfo`, 
    params,
    headers,
  };

  return req(opt).then( res => res.data, err => err.message);  
}

function getRain(params, headers){
  let opt = {
    method: 'GET',
    url: `${ENVURL_2}/luckymoney/info`, 
    params,
    headers,
  };

  return req(opt).then( res => res.data, err => err.message);  
}

function joinRain(data, headers){
  let opt = {
    method: 'POST',
    url: `${ENVURL_2}/luckymoney/start`, 
    data,
    headers,
  };

  return req(opt).then( res => res.data, err => err.message);  
}

function recordReward(data, headers){
  let opt = {
    method: 'POST',
    url: `${ENVURL_2$}/luckymoney/end`, 
    data,
    headers,
  };

  return req(opt).then( res => res.data, err => err.message);  
}

export default {
  getRain,
  joinRain,
  recordReward,  

  getUser,
}